﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PServiceBus.Gateway.Interfaces;
using PServiceBus.Gateway.ZeroMQ.DTO;
using PServiceBus.Core.Runtime.Gateway;
using PServiceBus.Core.Manager;

namespace PServiceBus.Gateway.ZeroMQ {
    public class ZeroMQRouterService : IRouterService {


        #region IMessageService Members

        public IGatewayServer Server { get; set; }

        public void RegisterRequestResponse() {
            Server.Register<ZeroMQRouterRequest, ZeroMQServiceInfos>(GetServices);
        }

        private static ZeroMQServiceInfos GetServices(ZeroMQRouterRequest request) {
            return new ZeroMQServiceInfos()
            {
                Services = ObjectManager<ServiceInfo>.Instance.ToArray()
            };
        }

        #endregion
    }
}
